/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.registration.web.controller;

import com.registration.core.Attendee;
import com.registration.membership.Member;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 *
 * @author Ggutierrez
 */
@Controller
@RequestMapping(value = "/pre-registro")
public class RegistrationController extends AbstractConfiguradorController {

    private static Logger log = LoggerFactory.getLogger(RegistrationController.class);

    @Override
    protected Logger getLogger() {
        return log;
    }
    
    @RequestMapping("/participante")
    @ResponseBody
    public Attendee findAttende(String firstName, String middleName, String lastName, String secondLastName, String memberId) {
        List<Attendee> attendes = registrationManager.findAttendees(firstName, middleName, lastName, secondLastName, memberId, "", "", null, null, null);
        return attendes != null && !attendes.isEmpty() ? attendes.get(0) : null;
    }

    @RequestMapping("/participantes")
    @ResponseBody
    public List<Attendee> findAttendes(String firstName, String middleName, String lastName, String secondLastName, String memberId) {
        List<Attendee> attendes = registrationManager.findAttendees(firstName, middleName, lastName, secondLastName, memberId, "", "", null, null, null);
        return attendes;
    }
    
    @RequestMapping("/member")
    @ResponseBody
    public Member findAttendes(String memberId) {
        Member member = registrationManager.loadMember(memberId);
        return member;
    }
}
